GH-4014: MQTT ClientManager: completion timeouts #8552
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #4014
The
ClientManagerimplementations uses by mistake aconnectionTimeoutfor operations with completion waitcompletionTimeoutanddisconnectCompletionTimeoutforClientManagerabstraction to realign the logic with existing channel adapters and Paho Client by itself.DEFAULT_COMPLETION_TIMEOUTandDISCONNECT_COMPLETION_TIMEOUTconstants in theAbstractMqttMessageDrivenChannelAdapterin favor of respective replacement in theClientManagerdisconnectCompletionTimeoutproperty from theMqttPahoMessageDrivenChannelAdapterto its superclassdisconnectCompletionTimeoutin theMqttv5PahoMessageDrivenChannelAdapterfor similardisconnectForcibly()callClientManageris started by the outbound channel adapter (Integer.MIN_VALUEphase and auto-startup - seeDefaultLifecycleProcessor.doStart()and logic arounddependencies) which is much earlier thanMessageProducerSupport(Integer.MAX_VALUE / 2phase) and there aconnectComplete()callback might be called before theMessageProducerSupport.start(). For that purpose check for anisRunning()in theconnectComplete()before subscribing and setreadyToSubscribeOnStartflag tosubscribe()in adoStart()of thisMqttMessageDrivenChannelAdapterMqttPahoMessageDrivenChannelAdapter.cleanSessionproperty in favor ofthis.clientFactory.getConnectionOptions().isCleanSession()callGH-8550: MQTT: Always re-subscribe on re-connect
Fixes #8550
Turns out the Paho MQTT client does not re-subscribe when connection re-established on automatic reconnection
AbstractMqttMessageDrivenChannelAdapterto always subscribe to their topics in theconnectComplete()independently of thereconnectstatusMOSQUITTO_CONTAINERimage restart in Docker